package com.ly.heart.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import com.ly.heart.domain.SurveyElectricEntity;
import com.ly.heart.mapper.SurveyElectricMapper;
import com.ly.heart.service.ISurveyElectricService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 勘测甲方用电情况记录Service业务层处理
 *
 * @author wutao
 * @date 2024-05-22
 */
@Service
public class SurveyElectricServiceImpl extends ServiceImpl<SurveyElectricMapper, SurveyElectricEntity> implements ISurveyElectricService {

    @Resource
    private SurveyElectricMapper erpSurveyElectricInfoMapper;

    /**
     * 查询勘测甲方用电情况记录
     *
     * @param id 勘测甲方用电情况记录ID
     * @return 勘测甲方用电情况记录
     */
    @Override
    public SurveyElectricEntity selectErpSurveyElectricInfoById ( String id ) {
        return erpSurveyElectricInfoMapper.selectErpSurveyElectricInfoById ( id );
    }

    /**
     * 查询勘测甲方用电情况记录列表
     *
     * @param erpSurveyElectricInfo 勘测甲方用电情况记录
     * @return 勘测甲方用电情况记录
     */
    @Override
    public List<SurveyElectricEntity> selectErpSurveyElectricInfoList ( SurveyElectricEntity erpSurveyElectricInfo ) {
        return erpSurveyElectricInfoMapper.selectErpSurveyElectricInfoList ( erpSurveyElectricInfo );
    }

    /**
     * 新增勘测甲方用电情况记录
     *
     * @param erpSurveyElectricInfo 勘测甲方用电情况记录
     * @return 结果
     */
    @Override
    public int insertErpSurveyElectricInfo ( SurveyElectricEntity erpSurveyElectricInfo ) {
        erpSurveyElectricInfo.setId ( SnowflakeIdWorker.getInstance ().nextStringId () );
        erpSurveyElectricInfo.setCreateTime ( DateUtils.getNowDate () );
        return erpSurveyElectricInfoMapper.insertErpSurveyElectricInfo ( erpSurveyElectricInfo );
    }

    /**
     * 修改勘测甲方用电情况记录
     *
     * @param erpSurveyElectricInfo 勘测甲方用电情况记录
     * @return 结果
     */
    @Override
    public int updateErpSurveyElectricInfo ( SurveyElectricEntity erpSurveyElectricInfo ) {
        erpSurveyElectricInfo.setChangeTime ( DateUtils.getNowDate () );
        return erpSurveyElectricInfoMapper.updateErpSurveyElectricInfo ( erpSurveyElectricInfo );
    }

    /**
     * 批量删除勘测甲方用电情况记录
     *
     * @param ids 需要删除的勘测甲方用电情况记录ID
     * @return 结果
     */
    @Override
    public int deleteErpSurveyElectricInfoByIds ( String[] ids ) {
        return erpSurveyElectricInfoMapper.deleteErpSurveyElectricInfoByIds ( ids );
    }

    /**
     * 删除勘测甲方用电情况记录信息
     *
     * @param id 勘测甲方用电情况记录ID
     * @return 结果
     */
    @Override
    public int deleteErpSurveyElectricInfoById ( String id ) {
        return erpSurveyElectricInfoMapper.deleteErpSurveyElectricInfoById ( id );
    }
}
